<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="teacher/_TFragment :: head(~{::title})">
    <meta charset="UTF-8">
    <title>资助申请审核</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/main.css">
    <script src="../../static/layui/layui.js"></script>
</head>
<style>
    #outCardBody>p>span{
        color: #1E9FFF;
        float: left;
        margin-right: 5px;
    }
    /*固定长宽，不然弹出层第一次位置会不对*/
    #outCard{
        width: 330px;
        height: 450px;
    }
</style>
<body>
    <!--头部导航部分-->
    <div class="header" th:replace="teacher/_TFragment :: topmenu">
        <div class="layui-col-md10">
            <span id="header-font">贫困生资助系统</span>
        </div>
        <ul class="layui-nav layui-col-md2">
            <li class="layui-nav-item" style="float: right">
                <a href=""><img src="//t.cn/RCzsdCq" class="layui-nav-img">我</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">修改信息</a></dd>
                    <dd><a href="javascript:;">安全管理</a></dd>
                    <dd><a href="javascript:;">退了</a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <!--主要内容部分-->
    <div class="layui-row">
        <!--左侧导航-->
        <ul th:replace="teacher/_TFragment :: leftmenu(6)" class="layui-nav layui-nav-tree  layui-col-md2" lay-filter="demo" style="height: 662px">
            <li class="layui-nav-item layui-nav-itemed">
                <a href="javascript:;"><i class="layui-icon">&#xe770;</i> 个人中心</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">主页</a></dd>
                    <dd><a href="javascript:;">用户信息</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="#"><i class="layui-icon">&#xe66f;</i> 学生信息</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;"><i class="layui-icon">&#xe6b2;</i> 经济困难认定</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">经济困难认定</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item layui-nav-itemed">
                <a href="javascript:;"><i class="layui-icon">&#xe857;</i> 资助管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">资源管理</a></dd>
                    <dd class="layui-this"><a href="javascript:;">资助申请审核</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;"><i class="layui-icon">&#xe631;</i> 系统管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;">修改密码</a></dd>
                </dl>
            </li>
        </ul>
        <!--右侧内容-->
        <div class="layui-col-md10">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>资助申请审核</legend>
            </fieldset>
            <form class="layui-form" action="" th:action="@{/teacher/support}">
                <div class="layui-form-item" style="margin-left: 5px">
                    资源名：
                    <div class="layui-inline">
                        <input class="layui-input" name="resourceName" id="resourceNameSearch">
                    </div>
                    <button class="layui-btn" lay-submit>搜索</button>
                </div>
            </form>
            <!--表格-->
            <table class="layui-table">
                <thead>
                <tr>
                    <th>资源名称</th>
                    <th>申请人姓名</th>
                    <th>申请人学号</th>
                    <th>认定结果</th>
                    <th>详情</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="supportVO,Iterable:${supportVOPage.records}">
                    <td th:text="${supportVO.resourceName}">资源名称</td>
                    <td th:text="${supportVO.studentName}">姓名</td>
                    <td th:text="${supportVO.studentNumber}">1234</td>
                    <td th:text="${supportVO.supportResult}">通过</td>
                    <td > <button class="layui-btn layui-btn-sm layui-btn-normal" onclick="chakan(1)" th:onclick="chakan([[${supportVO.supportId}]])">查看</button></td>
                    <td>
                        <a th:if="${supportVO.supportResult=='待认定'}" href="#" th:href="@{/teacher/clickSupport(supportId=${supportVO.supportId},supportResult='通过')}" type="button" class="layui-btn layui-btn-sm layui-btn-normal">通过</a>
                        <a th:if="${supportVO.supportResult=='待认定'}" href="#" th:href="@{/teacher/clickSupport(supportId=${supportVO.supportId},supportResult='未通过')}" type="button" class="layui-btn layui-btn-sm layui-btn-danger">不通过</a>
                        <button th:if="${supportVO.supportResult!='待认定'}" onclick="revoke(1)" th:onclick="revoke([[${supportVO.supportId}]])" type="button" class="layui-btn layui-btn-sm layui-btn-danger">撤销</button>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="layui-btn-group " style="float: right">
                <a href="#" th:href="@{/teacher/support(resourceName=${resourceName})}" type="button" class="layui-btn layui-btn-primary" >首页</a>
                <a href="#" th:href="@{/teacher/support(currentPage=${supportVOPage.current}-1,totalPage=${supportVOPage.pages},resourceName=${resourceName})}" type="button" class="layui-btn layui-btn-primary">上一页</a>
                <a href="#" th:href="@{/teacher/support(currentPage=${supportVOPage.current}+1,totalPage=${supportVOPage.pages},resourceName=${resourceName})}" type="button" class="layui-btn layui-btn-primary">下一页</a>
                <a href="#" th:href="@{/teacher/support(currentPage=${supportVOPage.pages},resourceName=${resourceName})}" type="button" class="layui-btn layui-btn-primary">尾页</a>
            </div>
        </div>
    </div>

    <!--弹出层-->
    <div class="layui-card" id="outCard" style="display: none;text-align: center;">
        <div class="layui-card-header">申请详情</div>
        <div id="outCardBody" class="layui-card-body">
        </div>
    </div>

    <!--撤销弹出层-->
    <div class="layui-card" id="delOutCard" style="display: none;text-align: center;">
        <div class="layui-card-header">消息</div>
        <div class="layui-card-body">
            是否撤销？
        </div>
        <div class="layui-card-body">
            <a id="revoke" href="#" type="button" class="layui-btn layui-btn-sm layui-btn-normal">确认</a>
            <a id="cancel" href="#" type="button" class="layui-btn layui-btn-sm layui-btn-primary">取消</a>
        </div>
    </div>
</body>
<script>
    layui.use('element', function(){
    });
    layui.use('form', function(){
    });
    layui.use('layer', function(){
        var $ = layui.jquery, layer = layui.layer;
        //点击查看
        window.chakan = function(supportId){
            var str = "";
            $.get({
                url:"/teacher/clickSupportChakan?supportId="+supportId,
                success: function (data) {
                    str +='<p><span>资源名:</span>' +data.resourceName+ '</p>\n' +
                    '<p><span>创建时间:</span>' +data.resourceTime+ '</p>\n' +
                    '<p><span>资源描述:</span>' +data.resourceInfo+ '</p>\n' +
                    '<p><span>资源级别:</span>' +data.resourceLevel+ '</p><hr class="layui-bg-blue">\n';

                    str += '<p><span>姓名:</span>' +data.studentName+ '</p>\n' +
                        '<p><span>性别:</span>' +data.studentSex+ '</p>\n' +
                        '<p><span>学号:</span>' +data.studentNumber+ '</p>\n' +
                        '<p><span>身份证:</span>' +data.studentCardid+ '</p>\n' +
                        '<p><span>入学年份:</span>' +data.studentYear+ '</p>\n' +
                        '<p><span>学历:</span>' +data.studentEducation+ '</p>\n' +
                        '<p><span>院系:</span>' +data.studentDepartment+ '</p>\n' +
                        '<p><span>班级:</span>' +data.studentClass+ '</p>\n' +
                        '<p><span>家庭人口数:</span>' +data.studentPopulation+ '</p>\n' +
                        '<p><span>户口:</span>' +data.studentRes+ '</p>\n' +
                        '<p><span>特殊条件:</span>';
                    if(data.specialOad){
                        str+='&nbsp孤残';
                    }
                    if(data.specialSp){
                        str+='&nbsp单亲';
                    }
                    if(data.specialCom){
                        str+='&nbsp烈士子女';
                    }
                    if(data.specialFo){
                        str+='&nbsp优抚对象';
                    }
                    if(data.specialSa){
                        str+='&nbsp低保家庭';
                    }
                    str +='</p><hr class="layui-bg-blue">\n';

                    $("#outCardBody").html(str);
                }
            });
            layer.open({
                title: false,
                type:1,
                content: $("#outCard")
            });
        }

        var msg = "[[${msg}]]";
        //弹出消息
        if (msg!=null&&msg!=""){
            layer.msg(msg);
        }
        //点击撤销
        window.revoke = function (supportId){
            $("#revoke").attr("href","/teacher/clickSupport?supportId="+supportId+"&supportResult=待认定");
            layer.open({
                title: false,
                type:1,
                content: $("#delOutCard")
            });
        }
        //点击取消关闭弹出层
        $("#cancel").click(function () {
            layer.closeAll('page');
        });
    });
</script>
</html>